/*
 * Copyright 2022 CAS—Atlantic (University of New Brunswick, CASA)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * SPDX-License-Identifier: Apache-2.0
 */
#ifndef _HASH_TABLE_H
#define _HASH_TABLE_H

#include <stdint.h>
#include <stdlib.h>
#include <string>
#include <unordered_map>

class Hashtable
{
  private:
    std::unordered_map<std::string, void *> my_map;

  public:
    // Adds an item to the hashtable.
    void add(std::string key, void *item);
    // Removes an item from the hashtable. If the item is not present, a null pointer is returned.
    void *remove(std::string key);
    // Gets an item from the hashtable without removing it. If the item is not present, a null pointer is returned.
    void *get(std::string key);
    // Check to see if the hashtable is empty.
    bool is_empty();
    // calls free on each item.
    void destroy_free_items();
};

#endif // _HASH_TABLE_H
